<?php

namespace App\Api\Resources;

use Illuminate\Http\Resources\Json\JsonResource;

class OrderResource extends JsonResource
{
    /**
     * Transform the resource into an array.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable
     */
    public function toArray($request)
    {
        return [
            'data_id' => $this->data_id,
            'order_status' => $this->order_info_orderstatus_text,
            'create_time' => $this->create_time->toDateTimeString(),
            'qrcode' => $this->order_info_qrcode,
            'price' => $this->order_info_payment / 100,
            'products' => $this->products,
            'address' => $this->address
        ];
    }
}
